package com.pgeg.materials;

import com.pgeg.listener.ItemListener;
import net.fabricmc.yarn.constants.MiningLevels;
import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Lazy;

import java.util.function.Supplier;

public enum ModToolMaterials implements ToolMaterial {
    ORICHALCUM(MiningLevels.NETHERITE, 2561, 9.0F, 6.0F, 10, () -> {
        return Ingredient.ofItems(ItemListener.ORICHALCUM_INGOT);
    }),
    SATURNIUM(MiningLevels.NETHERITE, 2761, 9.0F, 6.0F, 10, () -> {
        return Ingredient.ofItems(ItemListener.ORICHALCUM_INGOT);
    }),
    BRIMSTONE(MiningLevels.NETHERITE, 2761, 9.0F, 6.0F, 10, () -> {
        return Ingredient.ofItems(ItemListener.ORICHALCUM_INGOT);
    }),
    METEORITE(MiningLevels.NETHERITE, 2761, 9.0F, 6.0F, 10, () -> {
        return Ingredient.ofItems(ItemListener.ORICHALCUM_INGOT);
    }),
    COPPER_TOOL_MATERIALS(2, 1204, 6.0F, 1.5F, 13, () -> {
        return Ingredient.ofItems(ItemListener.COPPER_INGOT);
    }),
    MITHRIL(MiningLevels.NETHERITE, 2761, 9.0F, 6.0F, 10, () -> {
        return Ingredient.ofItems(ItemListener.ORICHALCUM_INGOT);
    }),
    SILVER_TOOL_MATERIALS(2,2761, 9.0F, 6.0F,25,() -> {
        return Ingredient.ofItems(ItemListener.SILVER_INGOT);
    }),

    SANDSTONE_TOOL_MATERIALS(0, 109, 3.0F, 0.5F, 3, () -> {
        return Ingredient.ofItems(Items.SANDSTONE);
    }),

    REDSTONE_TOOL_MATERIALS(1,204,7.0F,2.5F,40,() -> {
        return Ingredient.ofItems(Items.REDSTONE);
    });

    private final int miningLevel;
    private final int itemDurability;
    private final float miningSpeed;
    private final float attackDamage;
    private final int enchantability;
    private final Lazy<Ingredient> repairIngredient;

    private ModToolMaterials(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier<Ingredient> repairIngredient) {
        this.miningLevel = miningLevel;
        this.itemDurability = itemDurability;
        this.miningSpeed = miningSpeed;
        this.attackDamage = attackDamage;
        this.enchantability = enchantability;
        this.repairIngredient = new Lazy(repairIngredient);
    }

    @Override
    public int getDurability() {
        return this.itemDurability;
    }

    @Override
    public float getMiningSpeedMultiplier() {
        return this.miningSpeed;
    }

    @Override
    public float getAttackDamage() {
        return this.attackDamage;
    }

    @Override
    public int getMiningLevel() {
        return this.miningLevel;
    }

    @Override
    public int getEnchantability() {
        return this.enchantability;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return (Ingredient)this.repairIngredient.get();
    }
}
